package org.compression.controller;

import java.io.IOException;
import java.util.List;

import org.apache.log4j.Logger;
import org.compression.mapper.AccessIPStatMapper;
import org.compression.services.imp.BookServiceImp;
import org.compression.services.imp.SearchServiceImp;
import org.compression.test.Test;
import org.model.AttrValueRel;
import org.model.Book;
import org.model.BookAttr;
import org.model.MagazineAttrs;
import org.model.MagazineValue;
import org.model.TNewMagazine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class InsertController {

	private static Logger logger = Logger.getLogger(InsertController.class);


	@Autowired
	BookServiceImp mBookServiceImp;
	@Autowired
	Test test;

	@RequestMapping(value ="/insertbook", method = RequestMethod.POST)
	public Object insertbook(@RequestBody BookAttr book ) throws IOException {
		mBookServiceImp.insertBook(book);
		return "success";
	}

	@RequestMapping(value ="/searchTest", method = RequestMethod.GET)
	public void test() throws IOException {
		System.out.println(System.currentTimeMillis());
		long time=System.currentTimeMillis();
			System.out.println(Thread.currentThread().getName());
			test.test();
		
		long endtime=System.currentTimeMillis();
		System.out.println(endtime-time);
	}
	
	
	
	
	
	
	@Autowired
	AccessIPStatMapper mAccessIPStatMapper;
	
	/*
	@RequestMapping(value ="/gettest", method = RequestMethod.GET)
	public Object gettest() throws IOException {
		//return "";
		return mAccessIPStatMapper.getIps();
	
	}*/
	
	
	
	

}
